<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
    .parent{
        width:200px;
        /* height: 200px; */ 
        background-color: yellow;
    }
    .child{
        width: 100px;
        height: 100px;
        float: left;
        background-color: red;
    }
    .parent::after{
        content: "";
        display: table;
        clear: both;
    }
    </style>
</head>
<body>
    <div class="parent">
        <div class="child"></div>
    </div>
</body>
</html>